<?php

namespace App\Http\Resources\OpenShop\InvestmentPromotion;

use App\Enums\OpenShop\InvestmentPromotion\UserBaseInfoEnum;
use App\Service\OpenShop\Feishu\ConfigService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class BaseInfoDetailResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'mobile'             => $this->mobile,
            'remarkMobile1'      => $this->remarkMobile1,
            'remarkMobile2'      => $this->remarkMobile2,
            'email'              => $this->email,
            'weChatNumber'       => $this->weChatNumber,
            'isMarried'          => $this->isMarried,
            'provinceCode'       => $this->provinceCode,
            'cityCode'           => $this->cityCode,
            'districtCode'       => $this->districtCode,
            'address'            => $this->address,
            'addressPrefix'      => $this->addressPrefix,
            'postCode'           => $this->postCode,
            'source'             => $this->source,
            'sourceText'         => ConfigService::getConfigText("openShop", "source", $this->source),
            'isSelfManaged'      => $this->isSelfManaged,
            'joinReason'         => $this->joinReason,
            'joinReasontText'    => ConfigService::getConfigText("openShop", "joinReason", $this->joinReason),
            'shopBudget'         => $this->shopBudget,
            'shopBudgetText'     => sprintf('%s (万元)', $this->shopBudget),
            'investmentMode'     => $this->investmentMode,
            'investmentModeText' => ConfigService::getConfigText("openShop", "investmentMode", $this->investmentMode),
            'financeSource'      => $this->financeSource,
            'financeSourceText'  => ConfigService::getConfigText("openShop", "financeSource", $this->financeSource),
            'shopProvinceCode'   => $this->shopProvinceCode,
            'shopCityCode'       => $this->shopCityCode,
            'shopDistrictCode'   => $this->shopDistrictCode,
            'shopName'           => $this->shopName,
            'shopAddress'        => $this->shopAddress,

            'chooseShopProvinceCode'  => $this->chooseShopProvinceCode,
            'chooseShopCityCode'      => $this->chooseShopCityCode,
            'chooseShopDistrictCode'  => $this->chooseShopDistrictCode,
            'chooseShopAddressPrefix' => $this->chooseShopAddressPrefix,

            'shopAddressPrefix'       => $this->shopAddressPrefix,
            'isSelfWithAddress'       => $this->isSelfWithAddress,
            'clueNo'                  => $this->clueNo,
            'chooseAddressReason'     => $this->chooseAddressReason,
            'chooseAddressReasonText' => ConfigService::getConfigText("openShop", "chooseAddressReason",
                $this->chooseAddressReason),

            // 卡信息
            'cardNo'                  => $this->cardNo,
            'cardAccountName'         => $this->cardAccountName,
            'cardBankName'            => $this->cardBankName
        ];
    }
}
